package com.yanchangapp.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanchangapp.R;
import com.yanchangapp.model.bean.CntUserBean;

import java.util.List;

/**
 * Created by apple on 2019/7/16.
 * description:
 */
public class CntSheepAdapter extends BaseQuickAdapter<CntUserBean, BaseViewHolder> {

    public CntSheepAdapter(int layoutResId, @Nullable List<CntUserBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CntUserBean item) {
        helper.setText(R.id.tvSheep,item.getName());
        if (helper.getAdapterPosition() == getData().size()-1){
            helper.setVisible(R.id.ivSheep,false);
            helper.getView(R.id.tvSheep).setSelected(false);
        }else {
            helper.getView(R.id.tvSheep).setSelected(true);
            helper.setVisible(R.id.ivSheep,true);
        }
    }
}
